package chapter10_1_coutdown_latch;

public class JoinTest {

    public static void main(String[] args) throws InterruptedException {

        Thread A = new Thread(() -> {
            try {
                Thread.sleep(1000);
                System.out.println("A finish!");
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        });

        Thread B = new Thread(() -> {
            try {
                Thread.sleep(1000);
                System.out.println("B finish!");

            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        });
        System.out.println("main thread wait ..");

        A.start();
        B.start();

        A.join();
        B.join();
        System.out.println("all thread finish !");
    }
}